package com.itheima.web.controller.stat;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.cargo.ContractProductService;
import com.itheima.service.cargo.StatService;
import com.itheima.web.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@RequestMapping("/stat")
@Controller
class StatController extends BaseController {

    @Reference
    private StatService statService;

    //转发到不同的报表页面
    @RequestMapping("/toCharts")
    public String toCharts(String chartsType) {

        return "/stat/stat-" + chartsType;
    }

    @RequestMapping("/factoryCharts")
    public @ResponseBody List factoryCharts() {
        return statService.findFacotryAmount(companyId);
    }

    @RequestMapping("/sellCharts")
    public @ResponseBody List sellCharts()
    {
        return statService.findProductSell(companyId);
    }

    @RequestMapping("/onlineCharts")
    public @ResponseBody List findLogTime(){
        List logTime = statService.findLogTime(companyId);
        System.out.println("logTime : ------------ " + logTime);
        return logTime;
    }
}
